import App from './App';
import store from './store';
import uView from '@/uni_modules/uview-ui';
import globalVar from '@/utils/var';
import directives from '@/directives'; // directive
import {goPageByPath, resetForm, base64Encode, base64Decode} from '@/utils';
import ImageUpload from '@/components/ImageUpload';

Vue.use(uView);
Vue.use(directives);
Vue.component('ImageUpload', ImageUpload);

// #ifndef VUE3
import Vue from 'vue';
import './uni.promisify.adaptor';
Vue.config.productionTip = false;
Vue.prototype.$store = store;
Vue.prototype.globalVar = globalVar;
Vue.prototype.goPageByPath = goPageByPath;
Vue.prototype.resetForm = resetForm;
Vue.prototype.base64Encode = base64Encode;
Vue.prototype.base64Decode = base64Decode;
// 注册全局指令
App.mpType = 'app';

const app = new Vue({
    store,
    ...App,
});

require('@/utils/request.js')(app);

app.$mount();
// #endif

// #ifdef VUE3
import {createSSRApp} from 'vue';
export function createApp() {
    const app = createSSRApp(App);
    return {
        app,
    };
}
// #endif
